package jsen.tool.ddd.demo.domain.parking;

import jsen.tool.ddd.adapter.infrastructure.specification.ISpecification;
import jsen.tool.ddd.demo.domain.base.DomainObject;
import jsen.tool.ddd.demo.domain.parking.spec.parking.ParkingRecordSpec;
import jsen.tool.ddd.domain.AggregateObject;
import lombok.Builder;
import lombok.Getter;

/**
 * 停车记录
 *
 * @author jsen
 * @date 2021/10/6
 */
@AggregateObject(name = "ParkingRecord", desc = "停车记录")
@Getter
@Builder
public class ParkingRecord implements DomainObject {
    private final ISpecification<ParkingRecord> strict = new ParkingRecordSpec();
    private final Long recordId;
    private final Car car;
    private ParkingStatus parkingStatus;

    public void carOut() {
        this.parkingStatus = parkingStatus.freeze();
    }
}
